package com.qby.common.enums;

import com.qby.framework.constant.RedisConstant;

/**
 * @description: redis存贮短信类型
 * @author: qiu bo yang
 * @create: 2020-03-27 10:37
 */
public enum RedisMessageType {
    //注册短信
    REGISTER("1", RedisConstant.REGISTER_PREFIX),
    //忘记密码短信
    FORGET_PASSWORD("2", RedisConstant.FORGET_PASSWORD_PREFIX),
    //绑定手机号码短信
    BINDING_PHONE("3", RedisConstant.BINDING_PHONE_PREFIX);

    private String type;

    private String redisKey;

    RedisMessageType(String type, String redisKey) {
        this.type = type;
        this.redisKey = redisKey;
    }

    public static RedisMessageType convert(String type) {
        for (RedisMessageType statusEnum : RedisMessageType.values()) {
            if (statusEnum.getType().equals(type)) {
                return statusEnum;
            }
        }
        return null;
    }

    public String getType() {
        return type;
    }

    public String getRedisKey() {
        return redisKey;
    }

    public void setRedisKey(String redisKey) {
        this.redisKey = redisKey;
    }
}
